<template>
  <div class="movie-detal">
    <detalMain :MhotDatas="MhotDatas"></detalMain>
    <detalava
      :MhotDatas="MhotDatas"
      :MhotDatasYY="MhotDatasYY"
      :MhotDatasTT="MhotDatasTT"
    ></detalava>
    <footers></footers>
  </div>
</template>

<script>
import navs from "../components/navHeard";
import footers from "../components/footer";
import detalMain from "../components/movieDetail/movieMain";
import detalava from "../components/movieDetail/movieava";

export default {
  name: "Moviesdetail",
  data() {
    return {
      MhotDatas: "",
      MhotDatasYY: [],
      MhotDatasTT: "",
    };
  },
  components: {
    navs,
    detalMain,
    detalava,
    footers,
  },
  methods: {
    // 路由跳转过来后的id去数据库查询到的当前id数据
    async getHotDetail(id) {
      let hotData = await this.$http.get("/NowcnimenHotDetail", {
        params: { id: id },
      });
      this.MhotDatas = hotData.data.data[0];
      // console.log(this.MhotDatas);
    },

    async getHotDetailYY(id) {
      let hotData = await this.$http.get("/NowcnimenHotYY", {
        params: { id: id },
      });
      this.MhotDatasYY = hotData.data.data;
    },

    async getHotDetailTT(id) {
      let hotData = await this.$http.get("/NowcnimenHotTT", {
        params: { ids: id },
      });
      var arrTT = [];
      for (var TT of hotData.data.data) {
        let tts = TT.imagers.split("@")[0];
        // console.log(tts);
        arrTT.push(tts);
      }
      this.MhotDatasTT = arrTT;
      // console.log(this.MhotDatasTT);
    },
  },
  mounted() {
    // 跳转过来刷新页面
    // location.reload()
  },
  created() {
    let id = this.$route.query.id;
    this.getHotDetail(id);
    this.getHotDetailYY(id);
    this.getHotDetailTT(id);
  },
};
</script>

<style lang="scss" scoped></style>
